import { Dialog } from "vant";
import { createRouter, createWebHashHistory } from "vue-router";
import routes from "./routes";
const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

router.beforeEach((to, form, next) => {
  let isLogin = false; //未登录
  if (to.path === "/ranking" && isLogin == false) {
    Dialog({ message: "您未登录！", showCancelButton: true });
    next(false); //跳转到登入页next("/mymusic");留在原地next(false)
  } else {
    next(); //放行
  }
});
export default router;
